home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / xview / genial / ui / regdom.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-14  |  2.5 KB  |  144 lines

  1. /*
  2.  * regdom.c -- routines for setting / geting the region domains
  3.  *
  4.  */
  5.  
  6. #include <stdio.h>
  7. #include "display.h"
  8. #include "ui.h"
  9. #include "reg.h"
  10.  
  11. static char *reg_strtab[MAXREG] =
  12. {
  13.  "None", "line", "Spline", "C-Spline", "Polygon", "Box", "Dbl Line",
  14.     "All Image", "Text", "Arrow"};
  15.  
  16. /*
  17.  * reg_map[] is a map of the region types presently in the menu, for use by
  18.  * the menu proc.  So, for example, if the menu notify procedure for the
  19.  * region type is called with a value of 2, reg_map[value] will give the
  20.  * corresponding region type.
  21.  *
  22.  */
  23.  
  24. static int reg_map[MAXREG];
  25.  
  26. reg_setdom(grp)
  27.     int       grp;
  28. {
  29.     int       value;
  30.  
  31.     switch (grp) {
  32.     case LINEAR:
  33.     rdom_linear();
  34.     break;
  35.     case AREA:
  36.     rdom_area();
  37.     break;
  38.     case ANOT:
  39.     rdom_anot();
  40.     break;
  41.     case TRACE:
  42.     rdom_trace();
  43.     break;
  44.     case NONE:
  45.     if (getrtype() == NOREG) {
  46.         rdom_none();
  47.         return;
  48.     } else {
  49.         xv_set(base_win->reg_type,
  50.            PANEL_CHOICE_STRINGS,
  51.            reg_strtab[getrtype()],
  52.            NULL,
  53.            NULL);
  54.         reg_map[0] = getrtype();
  55.     }
  56.     break;
  57.     }
  58.     value = (int) xv_get(base_win->reg_type, PANEL_VALUE, NULL);
  59.     setrtype(reg_map[value]);
  60. }
  61.  
  62. /*
  63.  * Notify callback function for `reg_type'.
  64.  */
  65. void
  66. reg_type_proc(item, value, event)
  67.     Panel_item item;
  68.     int       value;
  69.     Event    *event;
  70. {
  71. #ifdef DEBUG
  72.     fprintf(stderr, "genial: reg_type_proc: value: %u\n", value);
  73. #endif
  74.     setrtype(reg_map[value]);
  75.  
  76.     line_setdom(reg_map[value]);
  77. }
  78.  
  79. rdom_linear()
  80. {
  81.     reg_map[0] = LINE;
  82.     reg_map[1] = SPLINE;
  83.     xv_set(base_win->reg_type,
  84.        PANEL_CHOICE_STRINGS,
  85.        reg_strtab[LINE],
  86.        reg_strtab[SPLINE],
  87.        NULL,
  88.        NULL);
  89. }
  90.  
  91. rdom_area()
  92. {
  93.     reg_map[0] = BOX;
  94.     reg_map[1] = ENTIRE_IMAGE;
  95.     reg_map[2] = POLYGON;
  96.     reg_map[3] = CLSPLINE;
  97.     xv_set(base_win->reg_type,
  98.        PANEL_CHOICE_STRINGS,
  99.        reg_strtab[BOX],
  100.        reg_strtab[ENTIRE_IMAGE],
  101.        reg_strtab[POLYGON],
  102.        reg_strtab[CLSPLINE],
  103.        NULL,
  104.        NULL);
  105. }
  106.  
  107. rdom_anot()
  108. {
  109.     reg_map[0] = AN_TEXT;
  110.     reg_map[1] = AN_VEC;
  111.     reg_map[2] = LINE;
  112.     reg_map[3] = SPLINE;
  113.     reg_map[4] = BOX;
  114.     xv_set(base_win->reg_type,
  115.        PANEL_CHOICE_STRINGS,
  116.        reg_strtab[AN_TEXT],
  117.        reg_strtab[AN_VEC],
  118.        reg_strtab[LINE],
  119.        reg_strtab[SPLINE],
  120.        reg_strtab[BOX],
  121.        NULL,
  122.        NULL);
  123. }
  124.  
  125. rdom_trace()
  126. {
  127.     reg_map[0] = LINE;
  128.     reg_map[1] = SPLINE;
  129.     xv_set(base_win->reg_type,
  130.        PANEL_CHOICE_STRINGS,
  131.        reg_strtab[LINE],
  132.        reg_strtab[SPLINE],
  133.        NULL,
  134.        NULL);
  135. }
  136.  
  137. rdom_none()
  138. {
  139.     xv_set(base_win->reg_type,
  140.        PANEL_CHOICE_STRINGS,
  141.        reg_strtab[NOREG], NULL,
  142.        NULL);
  143. }
  144.